﻿@using ZhouYu.DreamTour.Model;
@using ZhouYu.DreamTour.Web.Models;
@{
    var route = ViewBag.route as List<ScenicExhibition>;
    var UserInfo = UserInfoContext.userInfoContext.UserInfo;
}
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>中国梦想游-会员登录页</title>
    <link href="~/css/style.css" rel="stylesheet" type="text/css" />
    <link href="~/css/common.css" rel="stylesheet" type="text/css" />
    <link href="~/layui-v2.5.4/layui/css/layui.css" />
    <link href="~/layui-v2.5.4/layui/css/layui.mobile.css" />
    <script src="~/layui-v2.5.4/layui/layui.js"></script>
    <script src="~/layui-v2.5.4/layui/layui.all.js"></script>
    <script type="text/javascript" src="~/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="~/js/Format.js"></script>
</head>
<body>
    <div class="top_hw clearfix">
        <div class="top_h clearfix">
            <div class="top_hl"><span>欢迎来到中国梦想游，让你的梦想全程免费自由行！</span> 预定热线：<b>0571-63322269</b></div>
            <div class="top_hr">
                @if (UserInfo == null)
                {
                    <a href="/Home/User_Register">会员注册</a>
                    <span>|</span> <a href="/Home/User_Login">登录</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a>
                    @*<a>
                欢迎你，来到新世界旅行网！
            </a>*@
                }
                else
                {
                    <a href="/Home/User_Center">会员中心</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a> <span>|</span> <a href="/Login/LoginOut">退出</a> <span>|</span>
                    <a>
                        欢迎你，<span>@UserInfo.User_Name</span>来到新世界旅行网！
                    </a>
                }
            </div>
        </div>
    </div>
    <div class="head_w">
        <div class="head_t clearfix">
            <div class="logo"><img src="~/images/logo.jpg"></div>
            <div class="rx_line"><img src="~/images/rx.jpg"></div>
        </div>
    </div>
    <div class="mainNav clearfix">
        <ul class="Nav_ul">
            <li><a href="/Home/Index">首页</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Route">旅游路线</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Scenic">旅游景点</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/CateringAccommodation">餐饮住宿</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Traffic_DatailsOne">交通线路</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Group">旅游团购</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Specialty">地方特产</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/AutoGenerationIntro">自动生成简介</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Team_Join">团队简介</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Itinerary_Details">行程导航</a></li>
        </ul>
    </div>
    <div class="b_wrap">
        <div class="current"><span>当前所在地：</span><a href="/Home/Index">首页</a> >> <a href="/Home/User_Center">会员中心</a></div>
        <div class="fmember">
            <div class="fmleft">
                <div class="fmleft_top"><img src="~/images/fmbt1.png" border="0"></div>
                <div class="fmlist">
                    <ul>
                        <li class="f1">订单中心</li>
                        <li> >><a href="/Home/User_Order">我的订单</a> </li>
                        <li> >><a href="/Home/User_Colleague">发布结伴同行</a> </li>
                        <li> >><a href="/Home/User_Apply">我申请的结伴同行</a> </li>
                        <li> >><a href="/Home/User_Comment">我的点评</a> </li>
                        <li class="f2"> >><a href="/Home/User_Questions">我的提问</a> </li>
                    </ul>
                    <ul>
                        <li class="f1">我的优惠卡券</li>
                        <li> >><a href="/Home/User_CashAccount">现金账号</a> </li>
                        <li> >><a href="/Home/User_AllowanceVol">抵用券</a> </li>
                        <li class="f2"> >><a href="/Home/User_TouristVol">旅游券</a> </li>
                    </ul>
                    <ul>
                        <li class="f1">账户信息</li>
                        <li> >><a href="/Home/User_Data">个人资料</a> </li>
                        <li> >><a href="/Home/User_AccountSecurity">账户安全</a> </li>
                        <li>
                            >>
                            <a href="/Home/User_Bank">我的银行卡</a>
                        </li>
                        <li> >><a href="/Home/User_Integral">我的积分</a> </li>
                        <li> >><a href="/Home/User_UpdatePwd">修改密码</a> </li>
                        <li class="f2"> >><a href="/Home/User_Address">配送地址</a> </li>
                    </ul>
                </div>
            </div>
            <div class="fmright">
                <div class="fmr1">
                    <div class="fmr1_top">发布结伴同行</div>
                    <div class="fmr1_m">
                        <p class="fp2">结伴同行信息&nbsp;<span class="fspan7">(以下信息为必填)</span></p>
                        <p class="fp3">
                            <table border="0" cellpadding="0" cellspacing="0" width="638">
                                <tr>
                                    <td width="60" align="left" height="30">标题：</td>
                                    <td width="578" align="left" height="30"><input type="text" class="finput2" id="Colleague_Title"></td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30">旅游线路：</td>
                                    <td width="578" align="left" height="30">
                                        <select id="Route_Id">
                                            @for (int i = 0; i < route.Count; i++)
                                            {
                                                <option value="@route[i].Id">@route[i].TName</option>
                                            }
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30">出发时间：</td>
                                    <td width="578" align="left" height="30">
                                        <input type="text" id="Colleague_OutingTime" />
                                    </td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30" id="Number_Type">现有人数</td>
                                    <td width="578" align="left" height="30">
                                        @*<span class="Number_Kind">现有人数：</span>*@
                                        <span class="Number_Kind">男</span>&nbsp;<input type="number" class="Number_Count" min="0" value="0" style="width:10%" />
                                        <span class="Number_Kind">女</span>&nbsp;<input type="number" class="Number_Count" min="0" value="0" style="width:10%" />
                                        <span class="Number_Kind">小孩</span>&nbsp;<input type="number" class="Number_Count" min="0" value="0" style="width:10%" />
                                    </td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30" id="Number_Types">期望伴友：</td>
                                    <td width="578" align="left" height="30">
                                        <span class="Number_Kind">男</span>&nbsp;<input type="number" class="Number_Count" min="0" value="0" style="width:10%" />
                                        <span class="Number_Kind">女</span>&nbsp;<input type="number" class="Number_Count" min="0" value="0" style="width:10%" />
                                        <span class="Number_Kind">小孩</span>&nbsp;<input type="number" class="Number_Count" min="0" value="0" style="width:10%" />
                                    </td>
                                </tr>
                                @*<tr>
                                        <td colspan="2" height="30"><input type="checkbox" align="absmiddle">&nbsp;欢迎更多人申请结伴<img src="~/images/ficon3.png" align="absmiddle"></td>
                                    </tr>*@
                                <tr>
                                    <td width="100" align="left" height="30">支付方式：</td>
                                    <td width="578" align="left" height="30">
                                        <input type="radio" id="me" name="pay" checked>&nbsp;<span id="mePay">我支付</span>&nbsp;&nbsp;<input type="radio" id="aa" name="pay">&nbsp;<span id="aaPay">AA制</span>
                                    </td>
                                </tr>
                            </table>
                        </p>
                        <p class="fp2">我的基本信息&nbsp;<span class="fspan7"></span></p>
                        <p class="fp3">
                            <table border="0" cellpadding="0" cellspacing="0" width="638">
                                <tr>
                                    <td width="60" align="left" height="30">姓名：</td>
                                    <td width="578" align="left" height="30"><input type="text" id="Originator_Name" class="finput3"></td>
                                </tr>
                                <tr>
                                    <td width="60" align="left" height="30">性别：</td>
                                    <td width="578" align="left" height="30"><input type="radio" id="man" name="sex" checked>&nbsp;<span id="manSex">男</span>&nbsp;&nbsp;<input type="radio" id="woman" name="sex">&nbsp;<span id="womanSex">女</span></td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30">邮箱：</td>
                                    <td width="578" align="left" height="30">
                                        <input type="text" class="finput3" id="Originator_Email">
                                    </td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30">电话：</td>
                                    <td width="578" align="left" height="30">
                                        <input type="text" class="finput3" id="Originator_TelPhone">
                                    </td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30">个人介绍：</td>
                                    <td width="578" align="left" height="30">
                                        <textarea id="Originator_Content"></textarea>
                                    </td>
                                </tr>
                                @*<tr>
                                        <td colspan="2" height="30"><input type="checkbox" align="absmiddle">&nbsp;设置结伴贴置顶显示！</td>
                                    </tr>*@

                            </table>
                            <input type="button" class="layui-btn" id="commit" value="提交" style="margin-left:80%" />
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    //layui时间控件
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#Colleague_OutingTime' //指定元素
            , value: new Date()
            , min: 0
            , max: 7
        });
    });

    //提交按钮点击事件
    $("#commit").click(function () {
        //创建结伴同行人数集合
        var list = [];
        //循环获取人数信息
        $("#Number_Type + td span[class='Number_Kind']").each(function (i, data) {
            var number = {};
            number.Number_Count = $(this).next().val();
            number.Number_Type = $("#Number_Type").text();
            number.Number_Kind = $(this).text();
            //添加进集合
            list.push(number);
            //alert($("#Number_Type").text()+$(this).text()+$(this).next().val());
        });

        $("#Number_Types + td span[class='Number_Kind']").each(function (i, data) {
            var number = {};
            number.Number_Count = $(this).next().val();
            number.Number_Type = $("#Number_Type").text();
            number.Number_Kind = $(this).text();
            //添加进集合
            list.push(number);
            //alert($("#Number_Type").text()+$(this).text()+$(this).next().val());
        });
        //创建发起人对象
        var Originator = {};
        //获取发起人信息
        Originator.Originator_Name = $("#Originator_Name").val();
        Originator.Originator_Email = $("#Originator_Email").val();
        Originator.Originator_TelPhone = $("#Originator_TelPhone").val();
        Originator.Originator_Content = $("#Originator_Content").val();
        Originator.Originator_Sex = 1;
        //判断性别选中状态
        if ($("#woman").prop("checked")) {
            Originator.Originator_Sex = 0;
        }
        //创建自定义实体对象
        var data = {};
        //获取信息
        data.NumberList = list;
        data.Originator = Originator;
        data.Colleague_Title = $("#Colleague_Title").val();
        data.Route_Id = $("#Route_Id").val();
        data.Colleague_OutingTime = $("#Colleague_OutingTime").val();
        data.Colleague_PaymentMethod = $("#mePay").text();
        //判断支付方法选中状态
        if ($("#aa").prop("checked")) {
            data.Colleague_PaymentMethod = $("#aaPay").text();
        }
        //Ajax提交
        $.ajax({
            url: "/User/AddColleague",
            type: "post",
            data: data,
            success: function (result) {
                if (result.Success) {
                    layer.msg('申请提交成功！', {
                        title: '提示框',
                        icon: 1,
                        time: 2000
                    }, function () {
                        location.reload(true);
                    });
                }
                else {
                    layer.msg('申请提交失败！', {
                        title: '提示框',
                        icon: 1,
                        time: 2000
                    });
                }
            }
        });
    });
</script>
</html>

